<script lang="ts" setup>
import { reactive } from 'vue';

import {getCitysApi } from "@/api/citys";
import type {ICity} from "@/myTypes";


const citys:ICity[] = reactive([]);

const getCitys=()=>{
    getCitysApi()
    .then((res:any)=>{
        citys.length = 0;
        citys.push(...res.data);
    })
}

getCitys();

</script>

<template>
    <h1>城市列表</h1>
    <ul>
        <li v-for ="item in citys" :key="item.cityId">{{item.name}}</li>
    </ul>

</template>

<style lang="css" scoped>
    
</style>
